package com.apis.javacommon.base;

import com.apis.javacommon.page.Page;
import org.springframework.dao.DataAccessException;
import org.springframework.transaction.annotation.Transactional;

import java.io.Serializable;
import java.util.List;

/**
 * @author 
 */
@Transactional
public interface BaseService <E,Q extends Serializable>{
	
	@Transactional(readOnly=true)
	public E getById(Integer id) throws DataAccessException;
	
	@Transactional(readOnly=true)
	public List<E> findAll() throws DataAccessException;
	
	@Transactional(readOnly=true)
	public List<E> findAllByQuery(Q q) throws DataAccessException;
	
	
	/** 插入数据 */
	public E save(E entity) throws DataAccessException;
	
	
	public void physicsDelete(Integer id) throws DataAccessException;

	public void logicDelete(Integer id) throws DataAccessException;

	public E update(E entity) throws DataAccessException;
	
	/**
	 * 由分页信息查询分页记录
	 * @param object
	 * @return
	 */
	public Page findPage(Q e);
}
